package org.atlantis.mongo.writeresult;

import org.atlantis.mongo.MongoFactory;

import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;

public class WriteResultTrial {

	public void fillTrialData() {
		DBCollection dbc = MongoFactory.getCollection("trial.wr");
		for (int i = 0; i < 20; i++) {
			System.out.println(dbc.insert(new BasicDBObject().append("key", i).append("name", "name" + i))
					.getLastError());
		}
	}

	public void trialUpdate() {
		DBCollection dbc = MongoFactory.getCollection("trial.wr");
		System.out.println(dbc.update(new BasicDBObject("key", new BasicDBObject("$laat", 8)),
				new BasicDBObject("$set", new BasicDBObject("name", "atlantis")), false, true).getError());
	}

	public static void main(String[] args) {
		WriteResultTrial trial = new WriteResultTrial();
		trial.fillTrialData();
		trial.trialUpdate();
	}
}
